Repository navigation
Show a runnable example in each crate README and make it the crate doc - #302
Merged
Merged
Conversation
The READMEs of the 14 crates a reader may land on directly (the core and extra layers, their component crates, and the macro crates) now open with what CGP is, show a short program using the crate's main construct through the cgp crate, and keep the reference-page links their lib.rs docs listed. Each README is now its crate's documentation through include_str!, so docs.rs and crates.io show one text. The examples are marked rust,ignore, as the error backends' are: each uses the cgp crate, which the crate itself cannot depend on. Each example compiled and ran against this tree before the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The READMEs with an example relate CGP's tag line to the crate's own part rather than repeating one opening sentence, and introduce their reference links as what the website's reference covers. Every README closes on the same pointer to the website and the cgp crate's API. The error backends name Context-Generic Programming in full, drop their License sections as the other crates' READMEs do, and split two semicolon-joined sentences; cgp-macro-test-util's README loses its bold emphasis and jargon. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…examples as written The crate READMEs opened with one sentence pasted onto fourteen of them. Each opening now names Context-Generic Programming in a sentence about what that crate does, relating the idea of pluggable trait implementations to it, or leaving it out where it does not fit, as with the async trait macro. The error backends' examples ran their statements at the top level, which is not Rust a reader can copy; they now sit in `fn main()`, and the test crate's build script takes the body of `main` as the test it generates from each README. The `cgp` README quotes the checker's qualification as the other documents do, and the snapshot-test macros' README names CGP, splits its long opening sentence, labels its layout block as text, and wraps its prose at 100 columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The READMEs of the crates `cgp` re-exports ended with three single-sentence paragraphs, on the reference pages, on reaching the crate through `cgp`, and on the website, each starting fresh. They now read as two connected paragraphs: how a project reaches the crate and which reference pages cover it, then where to learn CGP itself. The small internal crates' READMEs read the same way, `cgp-core` and `cgp-extra` open with sentences that lead into their examples, and the error backends introduce their provider tables and join the short sentences about `String` errors and `std` features. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
[claude-opus-5-5] Most crate READMEs now show a short program using the crate's main construct, and each of those READMEs is also its crate's documentation, so crates.io and docs.rs show the same text. Before this PR, the crate docs held a sentence and a list of reference links, and most READMEs described the crate in a paragraph without an example.
Each README also places its crate in CGP. It names Context-Generic Programming in a sentence about what the crate does, and closes with how a project reaches the crate through
cgp, which reference pages cover it, and where to learn CGP itself. ThecgpREADME quotes thecargo cgp checkqualification in the wording the other documents use.Approach
The examples are not doctests, because each one goes through the
cgpcrate, which the crate it documents cannot depend on. They are markedrust,ignore, and each compiles and runs against this tree on stable. The error backends' three examples also run as tests incgp-tests, and they are now complete programs ending infn main()rather than statements at the top level.Areas needing attention
crates/tests/cgp-tests/build.rsnow takes the body offn main()in each error backend's README example as the test body, where it took the statements after the last item before. A block without that shape fails the build with the README's path.